<?php
class Category extends AppModel {

	var $name = 'Category';

	//The Associations below have been created with all possible keys, those that are not needed can be removed
	var $hasMany = array(
			'Product' => array('className' => 'Product',
								'foreignKey' => 'category_id',
								'dependent' => false,
			)
	);
    var $validate = array(
        'name' => array(
            'required' => array(
                'rule' => 'notEmpty',
                'message' => 'add category name'
            ),
            'unique' => array(
                'rule' => 'isUnique',
                'message' => 'category name must be unique'
            ),
        ),
        'url_name' => array(
            'required' => array(
                'rule' => 'notEmpty',
                'message' => 'add category url_name'
            ),
            'uniqe' => array(
                'rule' => 'isUnique',
                'message' => 'category url_name must be uniqe'
            )
        ),
        'descrition' => array(
            'alphanumeric'=>array(
                'rule'=> 'alphaNumeric',
                'message' => 'Only alphabets and numbers allowed'
            )
        )
    );
}
?>